//
//  YJWRecommendTagCell.m
//  百思不得骑姐
//
//  Created by YJW on 16/10/28.
//  Copyright © 2016年 yijiang. All rights reserved.
//

#import "YJWRecommendTagCell.h"
#import "YJWRecommendTagsModel.h"

#import <UIImageView+WebCache.h>

@interface YJWRecommendTagCell ()

@property (weak, nonatomic) IBOutlet UIImageView *imageV;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *subCountLabel;

@end

@implementation YJWRecommendTagCell

- (void)awakeFromNib {
    
    self.x = 10;
    
    [super awakeFromNib];
    
}

-(void)setRecommendTag:(YJWRecommendTagsModel *)recommendTag
{
    _recommendTag = recommendTag;

    self.nameLabel.text = recommendTag.theme_name;

    float count = recommendTag.sub_number / 10000.0;
    if (count >= 1) {
        self.subCountLabel.text = [NSString stringWithFormat:@"%.1f 万人关注",count];
    }else{
        self.subCountLabel.text = [NSString stringWithFormat:@"%ld 人关注",recommendTag.sub_number];
    }
    
    [self.imageV sd_setImageWithURL:[NSURL URLWithString:recommendTag.image_list] placeholderImage:[UIImage imageNamed:@"mainCellBackground"]];
}

/*
 *让 tableView 两边留有空隙的方法有三种：
 *  1、在 contentView 中添加一个 view，然后设置 view 的大小
 *  2、在 cell 中设置 contentView 的大小
 *  3、直接设置 cell 的大小，需要重写 setFrame 方法
 */
-(void)setFrame:(CGRect)frame{
    frame.origin.x = 10;
    frame.size.width -= 2 * frame.origin.x;
    frame.size.height -= 1;
    
    [super setFrame:frame];
}

@end
